home *** CD-ROM | disk | FTP | other *** search
- *
- * WINDOW.S
- * (vdilib.i & aeslib.i must be included at the end of the program)
- *
- * @createwindow
- *
- * Creates a simple gem window. It also initialises the application.
- *
- * In wtype equ %info move full close name
- * xstart,ystart,xwidth,ywidth,windowname(string terminated by 0)
- * Out w_handle,ap_id
- * (destroys a lot)
- *
- * @recalcwindow
- * Recalculates the window size.
- * (destroys a lot)
- *
- * @moveit
- * Moves the window. May be called at every vm_moved(=28) event.
- * In a0.l=adr to messagebuffer
- * (destroys a lot)
- *
- * @drawrsrc
- * Draws the rsrc.
- * This function draw doesn't care about clipping, so you should probably not use it.
- * In a0.l=adr to rsrc
- * (destroys a lot)
- *
- * @updatersrc
- * Draws the rsrc. Use this when receiving update events(=20).
- * This function takes care of all clipping.
- * In a0.l=adr to rsrc
- * (destroys a lot)
- *
- * @topwindow
- * Activates the window. May be called at every vm_topped(=21) event.
- * In a0.l=adr to messagebuffer
- * (destroys a lot)
- *
- * @bottomwindow
- * Bottoms the window if it's mine. May be called at every vm_bottomed(=33) event.
- * In a0.l=adr to messagebuffer
- * (destroys a lot)
- *
- * @button
- * Returns the object number that was clicked on. This function may be called
- * at every mousebutton event.
- * In a0.l=adr. to rsrc
- * (It automatically takes the x and y coordinates from int_out)
- * Out d0.w=object that was pressed or -1.
- * (destroys a lot)
- *
-
-
- include gemmacro.i
-
-
- @createwindow
- appl_init
- move.w d0,ap_id store the application id
-
- graf_handle
- move.w d0,current_handle Desktop's VDI handle
-
- * start by opening a virtual workstation
- lea intin,a0
- moveq #10-1,d0 -1 for DBF
- .fill move.w #1,(a0)+ most params are 1
- dbf d0,.fill
- move.w #2,(a0)+ use RC system
-
- v_opnvwk open it
-
- * set the mouse to an arrow
- graf_mouse #0 arrow please
-
- * we want to open a window, so find the usable size of the screen
- wind_get #0,#4 work area of Desktop
-
- * and create the window
- wind_create #wtype,xstart,ystart,xwidth,ywidth
- move.w d0,w_handle save the handle (error checks?)
-
- * now set its title
- move.l #windowname,int_in+4
- wind_set w_handle,#2 title string
-
- * now actually show it by opening
- movem.w xstart,d0-d3
- wind_open w_handle,d0,d1,d2,d3
-
- bsr @recalcwindow
- rts
-
-
- * calculate the work area of the window
- @recalcwindow
- wind_get w_handle,#4 get work area
- movem.w int_out+2,d0-d3
- movem.w d0-d3,xstart
- rts
-
-
- @moveit
- move.w 6(a0),d0
- cmp.w w_handle,d0
- bne .ut not my window!
- move.w 8(a0),int_in+4 new x pos
- move.w 10(a0),int_in+6 new y pos
- move.w 12(a0),int_in+8 width
- move.w 14(a0),int_in+10 heigth
- wind_set w_handle,#5
- bsr @recalcwindow
- .ut rts
-
- @drawrsrc move xstart,16(a0)
- move ystart,18(a0)
- objc_draw a0,#0,#10,xstart,ystart,xwidth,ywidth
- rts
-
- @button move xstart,16(a0)
- move ystart,18(a0)
- objc_find a0,#0,#10,int_out+2,int_out+4
- move int_out,d0
- rts
-
- @updatersrc move xstart,16(a0)
- move ystart,18(a0)
- move.l a0,a6
- wind_update #1
- wind_get w_handle,#11
- tst.w int_out+6
- bne .next
- tst.w int_out+8
- beq .out
- .next objc_draw a6,#0,#10,int_out+2,int_out+4,int_out+6,int_out+8
- wind_get w_handle,#12
- tst.w int_out+6
- bne .next
- tst.w int_out+8
- bne .next
- .out wind_update #0
- rts
-
- @topwindow
- move.w 6(a0),d0
- cmp.w w_handle,d0
- bne .ut not my window!
- wind_set w_handle,#10
- .ut rts
-
- @bottomwindow
- move.w 6(a0),d0
- cmp.w w_handle,d0
- bne .ut not my window!
- wind_set w_handle,#25
- .ut rts
-
- @exitwindow wind_close w_handle
- wind_delete w_handle
- rts
-
-
-
-
- * these have to remain together
- xstart ds.w 1
- ystart ds.w 1
- xwidth ds.w 1
- ywidth ds.w 1
-
- w_handle ds.w 1
- ws_handle ds.w 1
- ap_id ds.w 1
-
-
-